﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:Framework.UI.Controls"
                    xmlns:metro="http://schemas.codeplex.com/elysium"
                    xmlns:params="http://schemas.codeplex.com/elysium/params">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Elysium;component/Themes/Generic.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/FocusVisualStyle.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/Validation.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/WPF/Controls/MenuItem.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/Elysium/CommandButton.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/Elysium/DropDownCommandButton.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/ElysiumExtra/Icon.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/ElysiumExtra/GeometryIcon.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type controls:RichTextBoxExtended}" BasedOn="{StaticResource {x:Type RichTextBox}}">
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="True">
                <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ValidationErrorControlTemplate}"/>
                <Setter Property="Background" Value="{StaticResource ValidationErrorBrush}"/>
                <Setter Property="CaretBrush" Value="{StaticResource ForegroundBrush}"/>
                <Setter Property="ToolTip" Value="{StaticResource ValidationErrorToolTip}"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    
    <Style x:Key="RichTextBoxToolbar" TargetType="{x:Type Control}">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Control}">
                    <WrapPanel>
                        <metro:CommandButton Command="ApplicationCommands.Cut" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource CutCommandButtonStyle}"/>
                        <metro:CommandButton Command="ApplicationCommands.Copy" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource CopyCommandButtonStyle}"/>
                        <metro:CommandButton Command="ApplicationCommands.Paste" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource PasteCommandButtonStyle}"/>
                        <Separator/>
                        <metro:CommandButton Command="ApplicationCommands.Undo" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource UndoCommandButtonStyle}"/>
                        <metro:CommandButton Command="ApplicationCommands.Redo" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource RedoCommandButtonStyle}"/>
                        <Separator/>
                        <metro:CommandButton Command="EditingCommands.ToggleBold" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource BoldCommandButtonStyle}"/>
                        <metro:CommandButton Command="EditingCommands.ToggleItalic" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource ItalicCommandButtonStyle}"/>
                        <metro:CommandButton Command="EditingCommands.ToggleUnderline" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource UnderlineCommandButtonStyle}"/>
                        <Separator/>
                        <metro:DropDownCommandButton Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                                     Style="{StaticResource FontSizeDropDownCommandButtonStyle}">
                            <metro:DropDownCommandButton.Submenu>
                                <metro:Submenu>
                                    <MenuItem Focusable="False"  
                                              Header="{Binding Mode=TwoWay, Path=SelectionFontSize, UpdateSourceTrigger=PropertyChanged}"
                                              Style="{StaticResource FontSizeSliderMenuItemStyle}"/>
                                </metro:Submenu>
                            </metro:DropDownCommandButton.Submenu>
                        </metro:DropDownCommandButton>
                        <Separator/>
                        <metro:DropDownCommandButton Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                                     Style="{StaticResource ListDropDownCommandButtonStyle}">
                            <metro:DropDownCommandButton.Submenu>
                                <metro:Submenu>
                                    <MenuItem Command="EditingCommands.ToggleBullets" 
                                              CommandTarget="{Binding}"
                                              Style="{StaticResource BulletMenuItemStyle}"/>
                                    <MenuItem Command="EditingCommands.ToggleNumbering" 
                                              CommandTarget="{Binding}"
                                              Style="{StaticResource NumberingMenuItemStyle}"/>
                                </metro:Submenu>
                            </metro:DropDownCommandButton.Submenu>
                        </metro:DropDownCommandButton>
                        <Separator/>
                        <metro:DropDownCommandButton Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                                     Style="{StaticResource AlignDropDownCommandButtonStyle}">
                            <metro:DropDownCommandButton.Submenu>
                                <metro:Submenu>
                                    <MenuItem Command="EditingCommands.AlignLeft" 
                                              CommandTarget="{Binding}"
                                              Style="{StaticResource TextLeftAlignMenuItemStyle}"/>
                                    <MenuItem Command="EditingCommands.AlignCenter" 
                                              CommandTarget="{Binding}"
                                              Style="{StaticResource TextCenterAlignMenuItemStyle}"/>
                                    <MenuItem Command="EditingCommands.AlignRight" 
                                              CommandTarget="{Binding}"
                                              Style="{StaticResource TextRightAlignMenuItemStyle}"/>
                                    <MenuItem Command="EditingCommands.AlignJustify" 
                                              CommandTarget="{Binding}"
                                              Style="{StaticResource TextJustifyAlignMenuItemStyle}"/>
                                </metro:Submenu>
                            </metro:DropDownCommandButton.Submenu>
                        </metro:DropDownCommandButton>
                    </WrapPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="RichTextBoxToolbarSmallIcons" TargetType="{x:Type Control}">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Control}">
                    <WrapPanel>
                        <metro:CommandButton Command="ApplicationCommands.Cut" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource CutSmallCommandButtonStyle}"/>
                        <metro:CommandButton Command="ApplicationCommands.Copy" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource CopySmallCommandButtonStyle}"/>
                        <metro:CommandButton Command="ApplicationCommands.Paste" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource PasteSmallCommandButtonStyle}"/>
                        <Separator/>
                        <metro:CommandButton Command="ApplicationCommands.Undo" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource UndoSmallCommandButtonStyle}"/>
                        <metro:CommandButton Command="ApplicationCommands.Redo" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource RedoSmallCommandButtonStyle}"/>
                        <Separator/>
                        <metro:CommandButton Command="EditingCommands.ToggleBold" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource BoldSmallCommandButtonStyle}"/>
                        <metro:CommandButton Command="EditingCommands.ToggleItalic" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource ItalicSmallCommandButtonStyle}"/>
                        <metro:CommandButton Command="EditingCommands.ToggleUnderline" 
                                             CommandTarget="{Binding}"
                                             Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                             Style="{StaticResource UnderlineSmallCommandButtonStyle}"/>
                        <Separator/>
                        <metro:DropDownCommandButton Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                                     Style="{StaticResource FontSizeDropDownSmallCommandButtonStyle}">
                            <metro:DropDownCommandButton.Submenu>
                                <metro:Submenu>
                                    <MenuItem Header="{Binding Mode=TwoWay, Path=SelectionFontSize, UpdateSourceTrigger=PropertyChanged}"
                                              Style="{StaticResource FontSizeSliderMenuItemStyle}"/>
                                </metro:Submenu>
                            </metro:DropDownCommandButton.Submenu>
                        </metro:DropDownCommandButton>
                        <Separator/>
                        <metro:DropDownCommandButton Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                                     Style="{StaticResource ListDropDownSmallCommandButtonStyle}">
                            <metro:DropDownCommandButton.Submenu>
                                <metro:Submenu>
                                    <MenuItem Command="EditingCommands.ToggleBullets" 
                                              CommandTarget="{Binding}"
                                              Style="{StaticResource BulletMenuItemStyle}"/>
                                    <MenuItem Command="EditingCommands.ToggleNumbering" 
                                              CommandTarget="{Binding}"
                                              Style="{StaticResource NumberingMenuItemStyle}"/>
                                </metro:Submenu>
                            </metro:DropDownCommandButton.Submenu>
                        </metro:DropDownCommandButton>
                        <Separator/>
                        <metro:DropDownCommandButton Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                                     Style="{StaticResource AlignDropDownSmallCommandButtonStyle}">
                            <metro:DropDownCommandButton.Submenu>
                                <metro:Submenu>
                                    <MenuItem Command="EditingCommands.AlignLeft" 
                                              CommandTarget="{Binding}"
                                              Style="{StaticResource TextLeftAlignMenuItemStyle}"/>
                                    <MenuItem Command="EditingCommands.AlignCenter" 
                                              CommandTarget="{Binding}"
                                              Style="{StaticResource TextCenterAlignMenuItemStyle}"/>
                                    <MenuItem Command="EditingCommands.AlignRight" 
                                              CommandTarget="{Binding}"
                                              Style="{StaticResource TextRightAlignMenuItemStyle}"/>
                                    <MenuItem Command="EditingCommands.AlignJustify" 
                                              CommandTarget="{Binding}"
                                              Style="{StaticResource TextJustifyAlignMenuItemStyle}"/>
                                </metro:Submenu>
                            </metro:DropDownCommandButton.Submenu>
                        </metro:DropDownCommandButton>
                    </WrapPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>